<%--
  Created by IntelliJ IDEA.
  User: Alan4
  Date: 2023/1/31
  Time: 11:35
  To change this template use File | Settings | File Templates.
--%>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page isELIgnored="false"%>
	<%@include file="/public/head.jsp"%>

		<c:if test="${identity == '管理员'}">
		<!-- Modal -->
		<div class="modal fade" id="publishModal" tabindex="-1" aria-labelledby="publishModalLabel" aria-hidden="true">
		  <div class="modal-dialog  modal-dialog-centered modal-xl">
			<div class="modal-content">
			  <div class="modal-header">
				<h1 class="modal-title fs-5" id="publishModalLabel">发布任务</h1>
				<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
			  </div>
			  <div class="modal-body user-add-inputs">
				<table border="0" style="width: 100%;text-align: center;border-collapse: separate;border-spacing: 16px 8px;">
					<thead>
						<tr>
							<td>任务编号</td>
							<td>任务名称</td>
							<td>结束时间</td>
							<td>发布任务</td>
						</tr>
					</thead>
					<tbody>
					<c:forEach items="${tasks}" var="item">
						<tr>
							<td>${item.taskCode}</td>
							<td>${item.taskName}</td>
							<td><input type="datetime-local"/></td>
							<td>
								<span style="color: #2F88FF;cursor: pointer;" id="TASK${item.taskCode}" onclick="publishTask(this)">发布</span>
							</td>
						</tr>
					</c:forEach>
					</tbody>
				</table>
			  </div>
			</div>
		  </div>
		</div>
		</c:if>
		<!-- Modal -->
		<div class="modal fade" id="fulfilTaskModal" tabindex="-1" aria-labelledby="fulfilTaskModalLabel" aria-hidden="true">
		  <div class="modal-dialog  modal-dialog-centered modal-xl">
			<div class="modal-content">
			  <div class="modal-header">
				<h1 class="modal-title fs-5" id="fulfilTaskModalLabel">发布任务</h1>
				<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
			  </div>
			  <div class="modal-body user-add-inputs">
				<input id="task-fulfil-id" title="姓名" disabled onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text"/><br />
				<input id="task-fulfil-temperature" title="今日体温(必填)" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="number" placeholder="今日体温"/><br />
				<select id="task-fulfil-oneselfHealth" title="自己体征" class="department-add-input w-100">
					<option value="0">健康(自己体征)</option>
					<option value="1">体征异常(自己体征)</option>
				</select>
				<input id="task-fulfil-oneselfHealthDetails" hidden title="自己体征详情" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="自己体征异常情况(必填)"/><br />
				<input id="task-fulfil-address" title="当前居住地" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="当前居住地(必填)"/><br />
				<input id="task-fulfil-route" title="行程变化" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="行程变化(无变化可不填)"/><br />
				<select id="task-fulfil-familyHealth" title="一起居住的家人体征" class="department-add-input w-100">
					<option value="0">健康(一起生活的家庭成员体征)</option>
					<option value="1">体征异常(一起生活的家庭成员体征)</option>
				</select>
				<input id="task-fulfil-familyHealthDetails" hidden title="一起居住的家人体征详情" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="家庭成员体征异常情况(必填)"/><br />
			  </div>
			  <div class="modal-footer">
				<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
				<button id="task-fulfil-submit-btn" type="button" class="btn btn-primary">提交</button>
			  </div>
			</div>
		  </div>
		</div>
		<div class="container mt-3">
			<c:if test="${identity == '管理员'}">
				<div class="row text-center">
					<div class="col task-name-btns">
						<span class="task-publish-modal-btn" data-bs-toggle="modal" data-bs-target="#publishModal">发布任务</span>
					</div>
				</div>
			</c:if>
			<div class="row mt-5">
				<div class="col-12">
					<span style="font-weight: 600;">需要完成的任务</span>
					<hr />
				</div>
			  <div class="col-12">
				<table border="0" style="width: 100%;text-align: center;border-collapse: separate;border-spacing: 16px 32px;">
					<thead>
						<tr>
							<td style="width: 10%;">编号</td>
							<td style="width: 20%;">任务名</td>
							<td style="width: 30%;">开始时间</td>
							<td style="width: 30%;">结束时间</td>
							<td style="width: 10%;">状态</td>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${needComplete}" var="item">
						<tr>
							<td>${item.id}</td>
							<td>${item.taskName}</td>
							<td style="color: #2F88FF; cursor: pointer;">${item.startTimeStr}</td>
							<td style="color: red;">${item.endTimeStr}</td>
							<td style="color: #2F88FF; cursor: pointer;" onclick="fulfilTask(${item.id})">未完成</td>
						</tr>
						</c:forEach>
					</tbody>
				</table>
			  </div>
			</div>
			<c:if test="${identity == '管理员'}">
			<div class="row">
				<div class="col-12">
					<span style="font-weight: 600;">已发布的任务</span>
					<hr />
				</div>
				<div class="col-12">
					<table border="0" style="width: 100%;text-align: center;border-collapse: separate;border-spacing: 16px 32px;">
						<thead>
						<tr>
							<td style="width: 10%;">编号</td>
							<td style="width: 20%;">任务名</td>
							<td style="width: 30%;">开始时间</td>
							<td style="width: 30%;">结束时间</td>
							<td style="width: 10%;">导出</td>
						</tr>
						</thead>
						<tbody>
						<c:forEach items="${allAnnounces}" var="item">
							<tr>
								<td>${item.id}</td>
								<td>${item.taskName}</td>
								<td style="color: #2F88FF; cursor: pointer;">${item.startTimeStr}</td>
								<td style="color: red;">${item.endTimeStr}</td>
								<td style="color: #2F88FF; cursor: pointer;" onclick="taskExportExcel(${item.id})">导出</td>
							</tr>
						</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
			</c:if>
		</div>
	<%@include file="/public/foot.jsp"%>